package com.wukang.photovoltaicinspectionpictures.bean

import android.os.Parcel
import android.os.Parcelable

/**
 * 任务数据
 * @author wukang
 */
data class TaskData(
    var taskName: String? = "",
    var powerStationName: String? = "",
    var photographLocation: String? = "",
    var updateTime: Long = 0,
    var photographEquipment: String? = "",
    var photographNotes: String? = "",
    var testTime: Int = 0,
    var levelHigh: Int = 0,
    var levelMid: Int = 0,
    var levelLow: Int = 0,
    var levelNormal: Int = 0,
    var photographDataList: List<PhotographData>? = null
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readLong(),
        parcel.readString(),
        parcel.readString(),
        parcel.readInt(),
        parcel.readInt(),
        parcel.readInt(),
        parcel.readInt(),
        parcel.readInt(),
        parcel.createTypedArrayList(PhotographData)
    )

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(taskName)
        parcel.writeString(powerStationName)
        parcel.writeString(photographLocation)
        parcel.writeLong(updateTime)
        parcel.writeString(photographEquipment)
        parcel.writeString(photographNotes)
        parcel.writeInt(testTime)
        parcel.writeInt(levelHigh)
        parcel.writeInt(levelMid)
        parcel.writeInt(levelLow)
        parcel.writeInt(levelNormal)
        parcel.writeTypedList(photographDataList)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<TaskData> {
        override fun createFromParcel(parcel: Parcel): TaskData {
            return TaskData(parcel)
        }

        override fun newArray(size: Int): Array<TaskData?> {
            return arrayOfNulls(size)
        }
    }
}
